#include "stdio.h"
#include "string.h"
#include "stdlib.h"

/*
#include <string.h>

     char *
     strcpy(char * dst, const char * src);

 The stpcpy() and strcpy() functions copy the string src to dst (including
     the terminating `\0' character.)

  char *
     strncpy(char * dst, const char * src, size_t len);

 The stpncpy() and strncpy() functions copy at most len characters from
     src into dst.  If src is less than len characters long, the remainder of
     dst is filled with `\0' characters.  Otherwise, dst is not terminated.



*/

int printArray(char **  pArray, int num)
{
	int i = 0;

	if (pArray == NULL)
	{
		return -1;
	}

	for (i=0; i<num; i++)
	{
		printf("%s \n", pArray[i]);
	}

	return 0;
}

void main()
{
	int i = 0, j = 0;
	char **pArray = NULL;
	char *tmp = NULL;
	//构造内存
	pArray = (char **)malloc(100*sizeof(char *)); //int pArray[100];
	pArray[0] = (char *)malloc(12*sizeof(char)); //char buf[12];
	pArray[1] = (char *)malloc(200*sizeof(char)); //char buf[200];
	pArray[2] = (char *)malloc(200*sizeof(char)); //char buf[200];
	pArray[3] = (char *)malloc(200*sizeof(char)); //char buf[200];

	strcpy(pArray[0], "cccccc");
	strcpy(pArray[1], "aaaa");
	strcpy(pArray[2], "bbbb");
	strcpy(pArray[3], "11111");

	printArray(pArray, 4);

	system("pause");
}